from django.db import models
# from django.contrib.auth.models import AbstractUser

# Create your models here.

class StudentInfo(models.Model):
    snum=models.CharField(verbose_name="学生学号",max_length=32,primary_key=True)
    spwd=models.CharField(verbose_name="密码",max_length=32)
    avatar=models.CharField(verbose_name="用户头像",max_length=255,null=True,blank=True)
    sopenid=models.CharField(verbose_name="微信id",max_length=255,null=True,blank=True)
    sname=models.CharField(verbose_name="学生名字",max_length=32,null=True,blank=True)
    snickname=models.CharField(verbose_name="微信昵称",max_length=32,null=True,blank=True)
    gender_choice = (
        (1, 'male'),
        (2, 'female'),
        (3, 'others'),
    )
    gender = models.IntegerField(choices=gender_choice,null=True,blank=True)
    scountry=models.CharField(verbose_name="地区",max_length=32,null=True,blank=True)
    ssignature=models.CharField(verbose_name="个性签名",max_length=255,null=True,blank=True)
    scourse1=models.CharField(verbose_name="学生课程1",max_length=255,null=True,blank=True)
    scourse2=models.CharField(verbose_name="学生课程2",max_length=255,null=True,blank=True)
    scourse3=models.CharField(verbose_name="学生课程3",max_length=255,null=True,blank=True)
    scourse4=models.CharField(verbose_name="学生课程4",max_length=255,null=True,blank=True)
    scourse5=models.CharField(verbose_name="学生课程5",max_length=255,null=True,blank=True)
    scourse6=models.CharField(verbose_name="学生课程6",max_length=255,null=True,blank=True)
    scourse7=models.CharField(verbose_name="学生课程7",max_length=255,null=True,blank=True)
    scourse8=models.CharField(verbose_name="学生课程8",max_length=255,null=True,blank=True)
    scourse9=models.CharField(verbose_name="学生课程9",max_length=255,null=True,blank=True)
    scourse10=models.CharField(verbose_name="学生课程10",max_length=255,null=True,blank=True)


    def __str__(self):
        return self.sopenid

class StudentCourse(models.Model):
    coursenum=models.CharField(verbose_name="课程编号",max_length=255,primary_key=True)
    coursename=models.CharField(verbose_name="课程名",max_length=255,null=True,blank=True)
    courseclass1=models.CharField(verbose_name="课室1",max_length=255,null=True,blank=True)
    courseclass2=models.CharField(verbose_name="课室2",max_length=255,null=True,blank=True)
    snum=models.CharField(verbose_name="学生学号",max_length=255,null=True,blank=True)
    classtime1=models.CharField(verbose_name="上课时间1",max_length=255,null=True,blank=True)
    classtime2=models.CharField(verbose_name="上课时间2",max_length=255,null=True,blank=True)
    week1=models.CharField(verbose_name="上课日1",max_length=255,null=True,blank=True)
    week2=models.CharField(verbose_name="上课日2",max_length=255,null=True,blank=True)
    teanum=models.CharField(verbose_name="教师工号",max_length=255,null=True,blank=True)
    teaname=models.CharField(verbose_name="教师姓名",max_length=255,null=True,blank=True)
    stuname=models.CharField(verbose_name="学生姓名",max_length=255,null=True,blank=True)

    studentinfo=models.ManyToManyField(to="StudentInfo")

class StudentLeave(models.Model):
    leaveId=models.IntegerField(verbose_name="请假申请id",primary_key=True)
    stunum=models.CharField(verbose_name="学生学号",max_length=255,null=True,blank=True)
    stuname=models.CharField(verbose_name="学生姓名",max_length=255,null=True,blank=True)
    teaname=models.CharField(verbose_name="教师姓名",max_length=255,null=True,blank=True)
    course=models.CharField(verbose_name="课程名",max_length=255,null=True,blank=True)
    leavetime=models.CharField(verbose_name="请假课程上课时间",max_length=255,null=True,blank=True)
    stureason=models.CharField(verbose_name="请假理由",max_length=255,null=True,blank=True)
    status=models.CharField(verbose_name="审核状态",max_length=255,null=True,blank=True)
    teareason=models.CharField(verbose_name="不通过原因",max_length=255,null=True,blank=True)
    applyTime=models.CharField(verbose_name="请假时间",max_length=255,null=True,blank=True)
    teanum=models.CharField(verbose_name="教师工号",max_length=255,null=True,blank=True)
    classnum=models.CharField(verbose_name="课室号",max_length=255,null=True,blank=True)

class KaoQin(models.Model):
    attendid=models.IntegerField(verbose_name='考勤号',primary_key=True)
    stuname=models.CharField(verbose_name="学生姓名",max_length=255,null=True,blank=True)
    stunum=models.CharField(verbose_name="学号",max_length=255,null=True,blank=True)
    seatnum=models.CharField(verbose_name="座位号",max_length=255,null=True,blank=True)
    seatcoordinates=models.CharField(verbose_name="座位坐标",max_length=255,null=True,blank=True)
    classid=models.CharField(verbose_name="课室号",max_length=255,null=True,blank=True)
    attendancetype=models.IntegerField(verbose_name="打卡方式(1=扫码打卡，2=手动输入座位号打卡)",null=True,blank=True)
    attendancetime=models.CharField(verbose_name="打卡时间",max_length=255,null=True,blank=True)
    attendanceresult=models.IntegerField(verbose_name="考勤结果(1=正常,2=迟到，-1=旷课)",null=True,blank=True)
    avatar=models.CharField(verbose_name="学生相片",max_length=255,null=True,blank=True)

    def __str__(self):
        print(self.stunum,self.stuname)


class TeacherInfo(models.Model):
    teanum=models.CharField(verbose_name="教师工号",max_length=255,primary_key=True)
    password=models.CharField(verbose_name="登陆密码",max_length=255,null=True,blank=True)
    teaname=models.CharField(verbose_name="教师姓名",max_length=255,null=True,blank=True)
    course1=models.CharField(verbose_name="课程号1",max_length=255,null=True,blank=True)
    course2=models.CharField(verbose_name="课程号2",max_length=255,null=True,blank=True)
    course3=models.CharField(verbose_name="课程号3",max_length=255,null=True,blank=True)
    course4=models.CharField(verbose_name="课程号4",max_length=255,null=True,blank=True)
    course5=models.CharField(verbose_name="课程号5",max_length=255,null=True,blank=True)


class TeacherCourse(models.Model):
    course=models.CharField(verbose_name="课程号",max_length=255,primary_key=True)
    coursename = models.CharField(verbose_name="课程名称", max_length=255, null=True, blank=True)
    class1 = models.CharField(verbose_name="教室1", max_length=255, null=True, blank=True)
    class2 = models.CharField(verbose_name="教室2", max_length=255, null=True, blank=True)
    class3 = models.CharField(verbose_name="教室3", max_length=255, null=True, blank=True)
    teanum = models.CharField(verbose_name="教师工号", max_length=255, null=True, blank=True)
    classtime1 = models.CharField(verbose_name="上课时间1", max_length=255, null=True, blank=True)
    classtime2 = models.CharField(verbose_name="上课时间2", max_length=255, null=True, blank=True)
    classtime3 = models.CharField(verbose_name="上课时间3", max_length=255, null=True, blank=True)
    week1 = models.CharField(verbose_name="上课日1", max_length=255, null=True, blank=True)
    week2 = models.CharField(verbose_name="上课日2", max_length=255, null=True, blank=True)
    week3 = models.CharField(verbose_name="上课日3", max_length=255, null=True, blank=True)


class CourseInfo(models.Model):
    teanums=models.CharField(verbose_name="教师工号",max_length=255, null=True, blank=True)
    teaname=models.CharField(verbose_name="任课教师",max_length=255, null=True, blank=True)
    classtime=models.CharField(verbose_name="节数",max_length=255, null=True, blank=True)
    course1=models.CharField(verbose_name="周一课程",max_length=255, null=True, blank=True)
    course2=models.CharField(verbose_name="周二课程",max_length=255, null=True, blank=True)
    course3=models.CharField(verbose_name="周三课程",max_length=255, null=True, blank=True)
    course4=models.CharField(verbose_name="周四课程",max_length=255, null=True, blank=True)
    course5=models.CharField(verbose_name="周五课程",max_length=255, null=True, blank=True)

class ClassInfo(models.Model):
    classid=models.IntegerField(verbose_name="课室id",primary_key=True)
    rowline=models.CharField(verbose_name="课室座位的行数",max_length=255, null=True, blank=True)
    rowcolumn=models.CharField(verbose_name="课室座位的列数",max_length=255, null=True, blank=True)
    coursename=models.CharField(verbose_name="课程名称",max_length=255, null=True, blank=True)
    classroomnum=models.CharField(verbose_name="教室号",max_length=255, null=True, blank=True)
    studentnum=models.CharField(verbose_name="学生人数",max_length=255, null=True, blank=True)
    seatnum=models.CharField(verbose_name="座位数",max_length=255, null=True, blank=True)
    teanum=models.CharField(verbose_name="教师工号",max_length=255, null=True, blank=True)


class ClassRoom(models.Model):
    classid = models.CharField(verbose_name="课室id",max_length=255, primary_key=True)
    rowline = models.CharField(verbose_name="课室座位的行数", max_length=255, null=True, blank=True)
    rowcolumn = models.CharField(verbose_name="课室座位的列数", max_length=255, null=True, blank=True)
    seatnum=models.IntegerField(verbose_name="座位数",null=True, blank=True)


class AttendanceRecord(models.Model):
    snum=models.CharField(verbose_name="学号",max_length=255, null=True, blank=True)
    stuname=models.CharField(verbose_name="学生姓名",max_length=255, null=True, blank=True)
    ad_clock_time=models.CharField(verbose_name="打卡时间",max_length=255, null=True, blank=True)
    ad_result=models.CharField(verbose_name="考勤结果",max_length=255, null=True, blank=True)
    ad_course_name=models.CharField(verbose_name="课程名",max_length=255, null=True, blank=True)
    ad_course_time=models.CharField(verbose_name="课程时间",max_length=255, null=True, blank=True)
    ad_begin=models.CharField(verbose_name="考勤开始时间",max_length=255, null=True, blank=True)
    ad_end=models.CharField(verbose_name="考勤结束时间",max_length=255, null=True, blank=True)
    teaname=models.CharField(verbose_name="授课教师",max_length=255, null=True, blank=True)
    teanum=models.CharField(verbose_name="教师工号",max_length=255, null=True, blank=True)

class TestInfo(models.Model):
    phone=models.BigIntegerField()
    name=models.CharField(max_length=255,verbose_name="姓名")